package com.springboot.provider;

import com.springboot.pojo.User;
import org.apache.ibatis.jdbc.SQL;

public class UserProvider {
    public String getUserById(User user) {
        return new SQL(){
            {
                SELECT("*");
                FROM("user");
                if (user.getId() != null) {
                    WHERE("id = #{id}");
                }
                if (user.getUsername() != null) {
                    WHERE("name = #{name}");
                }
            }
        }.toString();
    }
}
